#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
@File    :   py_pub.py
@Time    :   2025/10/19 18:37:47
@user    :   wk 
@Version :   1.0
@Desc    :   None
'''



import rospy
from std_msgs.msg import String

class Pub:
    def __init__(self) -> None:
        rospy.init_node("py_pub")
        self.rate = rospy.Rate(10)

        self.pub = rospy.Publisher("data",String,queue_size=10) # 创建发布者
    
    def main(self):
        msg = String()
        msg.data = "py发布"
        rospy.sleep(3)    # 等待注册
        while not rospy.is_shutdown():
            self.pub.publish(msg)
            self.rate.sleep()

    


if __name__ == '__main__':
    Pub().main()
    rospy.spin()